package com.ruiysoft.service.sys.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruiysoft.entity.sys.SysShopPersonnel;
import com.ruiysoft.mapper.sys.SysShopPersonnelMapper;
import com.ruiysoft.service.sys.ISysShopPersonnelService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author huazengguang
 * @since 2018-11-01
 */
@Service
public class SysShopPersonnelServiceImpl extends ServiceImpl<SysShopPersonnelMapper, SysShopPersonnel> implements ISysShopPersonnelService {

    @Resource
    SysShopPersonnelMapper sysShopPersonnelMapper;

    @Override
    public void insertIgnore(SysShopPersonnel sysShopPersonnel) {
        System.out.println("插入SysShopPersonnel");
        sysShopPersonnelMapper.insertIgnore(sysShopPersonnel);
    }

    @Override
    public Page<SysShopPersonnel> selectPersonnelList(@NotNull @Valid Integer pageStart, @NotNull @Valid Integer pageSize, @NotNull @Valid Long shopId) {
        Page<SysShopPersonnel> page = new Page<>(pageStart, pageSize);
        return page.setRecords(sysShopPersonnelMapper.selectPersonnelList(page,shopId));
    }
    @Override
    public Page<SysShopPersonnel> selectPersonnelRalationList(@NotNull @Valid Integer pageStart, @NotNull @Valid Integer pageSize, @NotNull @Valid Long shopId) {
        Page<SysShopPersonnel> page = new Page<>(pageStart, pageSize);
        return page.setRecords(sysShopPersonnelMapper.selectPersonnelRalationList(page,shopId));
    }

    @Override
    public Page<SysShopPersonnel> getPersonnelByParentId(Integer pageStart, Integer pageSize, Long shopId, Long userId) {
        Page<SysShopPersonnel> page = new Page<>(pageStart, pageSize);
        return page.setRecords(sysShopPersonnelMapper.getPersonnelByParentId(page,shopId,userId));
    }

}
